-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor configuration loading to parse profile files only once #2152
Conversation
b905766
to
c0080e0
Compare
A new generated diff is ready to view.
A new doc preview is ready to view. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I like how parsing profile files is now single-sourced in ProviderConfig
.
/// .load() | ||
/// .await; | ||
/// # } | ||
pub fn profile_name(mut self, profile_name: impl Into<String>) -> Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be worth linking to https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html or similar
/// This **does not set** the HTTP connector used when sending operations. To change that | ||
/// connector, use [ConfigLoader::http_connector]. | ||
/// | ||
/// NOTE: Update the provider config with care because it will override any other settings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we be more specific about what this will override? I'm wondering if we should rename ProviderConfig
to better highlight the stuff it provides. I'm thinking of something like this:
OsProvider
PlatformProvider
SystemProvider
match AppName::new(app_id.to_owned()) { | ||
Ok(app_name) => Some(app_name), | ||
Err(err) => { | ||
tracing::warn!(err = %err, "`sdk-ua-app-id` property `{}` was invalid", app_id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If possible, we should consider the following:
- add a call to action here that tells people how to fix this or stop the warning
- explain to users what value will be used instead
- explain to users how this may affect logging of requests
- explain why you would want to set this
- explain what makes an app ID invalid
We could perhaps link users to docs, but I couldn't find any that described this field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
%err will include details so this should be OK
&& profile_set.selected_profile() == "default" | ||
&& profile_set.get_profile("default").is_none() | ||
{ | ||
if profile_set.selected_profile() == "default" && profile_set.get_profile("default").is_none() { | ||
tracing::debug!("No default profile defined"); | ||
return Err(ProfileFileError::NoProfilesDefined); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible for a user to have other profiles but they forgot to set the profile name? If so, then I think this error could be improved. It's not so much that no profiles were defined but that the selected profile (default
) couldn't be found.
c0080e0
to
02af1b5
Compare
A new generated diff is ready to view.
A new doc preview is ready to view. |
Co-authored-by: Zelda Hessler <zhessler@amazon.com>
Co-authored-by: Zelda Hessler <zhessler@amazon.com>
174e066
to
be5b69e
Compare
A new generated diff is ready to view.
A new doc preview is ready to view. |
Motivation and Context
Description
Testing
Checklist
CHANGELOG.next.toml
if I made changes to the AWS SDK, generated SDK code, or SDK runtime cratesBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.